<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 4.1 string(数据); 会返回转换后的结果
        let str = String(123);
        console.log(String(true)); // 123
        // 4.2 变量.toString(进制)
        let num = 10;
        let str1 = num.toString(2);
        console.log(str1); // 1010
        // 5·转换为布尔值 Boolean（数据）
        console.log(Boolean(10)); 
        console.log(Boolean('天少'));
        // 能转换为false的情况
        console.log(Boolean(0));
        console.log(Boolean(false));
        console.log(Boolean(undefined));
        console.log(Boolean(null));
        console.log(Boolean(NaN));
        console.log(Boolean(''));
    </script>
</body>
</html>